public class Demo50 {
    class Treenode{
        int val;
        Treenode right;
        Treenode left;
        public Treenode(int val){
            this.val = val;
        }
    }
    public Treenode root;
    public boolean search(int key){
Treenode cur = root;
while(cur != null){
    if(cur.val == key){
        return true;
    } else if (cur.val < key) {
        cur = cur.left;
    }
    else{
        cur = cur.right;
    }
}
return false;
    }

   
}
